<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        console.log(Math.PI);

        console.log(Math.abs(-5));//传递不是数字类型的值：先基于Number()转换为数字再处理

        console.log(Math.ceil(4.2));//向上取整
        console.log(Math.floor(4.2));//向下取整
        console.log(Math.round(4.2));//四舍五入  正数.5属于入  负数.5属于舍

        console.log(Math.max(2, 5, 4, 5));
        console.log(Math.min(2, 5, 4, 5));

        console.log(Math.sqrt(5));//开方   负数不能开方
        console.log(Math.pow(5, 3));//多少次幂

        console.log(Math.round(Math.random() * (5 - 1) + 1)); //1到5随机小数
    </script>
</body>

</html>